<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<%-- @author: Christian Baumhof --%>

<%-- Title --%>
<h1>
	<s:text name="title.gradeOverview" />
</h1>

<%-- Maniple selection --%>
<s:form action="ShowGradeOverview">
	<table class="formTable">
		<tr>
			<td><s:text name="lbl.maniple" /></td>
			<td><s:select theme="simple" name="selectedManipleId"
					list="maniples" listKey="id" listValue="name"
					value="selectedManipleId" /></td>
		</tr>
	</table>
	<s:submit theme="simple" key="button.show" />
</s:form>

<%-- Data table --%>
<table>
	<%-- Link row (edit buttons) --%>
	<tr>
		<td class="emptyCell">&nbsp;</td>
		<s:iterator value="subjects" var="subject">
			<td class="linkRow"><s:form>
					<s:hidden name="id" />
					<s:hidden name="selectedManipleId" />
					<s:submit theme="simple" key="button.edit"
						action="ShowExamOverview" />
				</s:form></td>
		</s:iterator>
		<td class="emptyCell">&nbsp;</td>
	</tr>

	<%-- Column headlines --%>
	<tr>
		<th><s:text name="lbl.student" /></th>
		<s:iterator value="subjects">
			<th><span title=<s:property value="description"/>> <s:property
						value="title" /></span></th>
		</s:iterator>
		<th>&nbsp;</th>
	</tr>

	<%-- Data --%>
	<s:iterator value="students" status="nrStudent">
		<tr
			<s:if test="#nrStudent.odd == true">
				class="highlighted"
			</s:if>>

			<%-- Results --%>
			<td class="alignLeft"><s:property value="lastName" />, <s:property
					value="firstName" /></td>

			<s:iterator value="subjects" status="nrSubject">
				<td><s:if
						test="numberTries[#nrSubject.index][#nrStudent.index]==0">-
					</s:if> <s:if test="numberTries[#nrSubject.index][#nrStudent.index]>=1">
						<s:property
							value="results[#nrSubject.index][#nrStudent.index][0].grade" />
						(<s:property
							value="results[#nrSubject.index][#nrStudent.index][0].examTry" />)
					</s:if> <s:if test="numberTries[#nrSubject.index][#nrStudent.index]>=2">
						<br>
						<s:property
							value="results[#nrSubject.index][#nrStudent.index][1].grade" />
					(<s:property
							value="results[#nrSubject.index][#nrStudent.index][1].examTry" />)
					</s:if> <s:if test="numberTries[#nrSubject.index][#nrStudent.index]==3">
						<br>
						<s:property
							value="results[#nrSubject.index][#nrStudent.index][2].grade" />
					(<s:property
							value="results[#nrSubject.index][#nrStudent.index][2].examTry" />)
					</s:if></td>
			</s:iterator>

			<%-- History button --%>
			<td><s:form theme="simple">
					<s:hidden name="id" />
					<s:submit theme="simple" key="button.history" action="ShowHistory" />
				</s:form></td>
		</tr>
	</s:iterator>
</table>

<%-- Footnote --%>
<s:text name="gradeOverview.footnote" />

